package com.sxt.bus.service.impl;

import com.sxt.bus.constant.BUSConstant;
import com.sxt.bus.domain.Mobiles;
import com.sxt.bus.mapper.MobilesMapper;
import com.sxt.bus.service.MobilesService;
import com.sxt.bus.utils.MobileNumberUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author WanMing
 * @date 2019/2/8 11:21
 */

@Service
public class MobilesServiceImpl implements MobilesService {

    @Autowired
    private MobilesMapper mobilesMapper;

    @Override
    public void addMobiles(List<String> number, String mobilesType) {
        if(null!=number && !number.isEmpty()){
            for (String num : number) {
                mobilesMapper.insertSelective(new Mobiles(num,mobilesType, MobileNumberUtils.getStringRandom(BUSConstant.CARD_NUMBER),BUSConstant.AVAILABLE));
            }
        }
    }
}
